4446fd
@@ -770,9 +770,14 @@
public Path getDefaultDestDir(Configuration conf) throws LoginException, IOExcep
     String hdfsDirPathStr = jarPathStr;
     Path hdfsDirPath = new Path(hdfsDirPathStr);
 
-    FileStatus fstatus = fs.getFileStatus(hdfsDirPath);
-    if (!fstatus.isDir()) {
-      throw new IOException(ErrorMsg.INVALID_DIR.format(hdfsDirPath.toString()));
+    try {
+      FileStatus fstatus = fs.getFileStatus(hdfsDirPath);
+      if (!fstatus.isDir()) {
+        throw new IOException(ErrorMsg.INVALID_DIR.format(hdfsDirPath.toString()));
+      }
+    } catch (FileNotFoundException e) {
+      // directory does not exist, create it
+      fs.mkdirs(hdfsDirPath);
     }
 
     Path retPath = new Path(hdfsDirPath.toString() + "/.hiveJars");
